<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="layui/css/layui.css" rel="stylesheet">
    <script src="layui/layui.js"></script>
    <script type="text/javascript" src="layui/tableSelect.js"></script>
</head>
<body>

<form id="myform" lay-filter="updateform"
      class="layui-form layui-form-pane"
      style="margin: 30px auto; display: inline-block;" >
    <div class="layui-form-item" style="text-align: center;">
        <label class="layui-form-label layui-bg-gray" style="width: 140px; margin-left: 35px">证券ID</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="required"
                   autocomplete="off" placeholder="证券ID" class="layui-input" name="securityId" id="securityId">
        </div>
        <label class="layui-form-label layui-bg-gray" style=" width: 140px;margin-left: 50px;">证券名称</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="required"
                   autocomplete="off" placeholder="证券名称" class="layui-input" name="securityName" id="securityName">
        </div>
    </div>
    <div class="layui-form-item" style="text-align: center;">
        <label class="layui-form-label layui-bg-gray" style="width: 140px; margin-left: 35px">发行日期</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="required"
                   autocomplete="off" placeholder="发行日期" class="layui-input" id="releaseDate" name="releaseDate">
        </div>
        <label class="layui-form-label layui-bg-gray" style="width: 140px; margin-left: 35px">延迟日期</label>
        <div class="layui-input-inline">
            <input type="number" lay-verify="required"
                   autocomplete="off" placeholder="延迟日期" class="layui-input" id="delayDate" name="delayDate">
        </div>
    </div>
    <div class="layui-form-item" style="text-align: center;">
        <label class="layui-form-label layui-bg-gray" style="width: 140px; margin-left: 35px">证券类型</label>
        <div class="layui-input-inline">
            <input type="number" lay-verify="required"
                   autocomplete="off" placeholder="证券类型" class="layui-input" id="securityType" name="securityType">
        </div>
        <label class="layui-form-label layui-bg-gray" style="width: 140px; margin-left: 35px">交易所</label>
        <div class="layui-input-inline">
            <select name="exchange" id="exchange">
                <option placeholder="请选择"></option>
                <option value="2">上海交易所</option>
                <option value="1">深圳交易所</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item" style="text-align: center;">
        <label class="layui-form-label layui-bg-gray" style="width: 140px; margin-left: 35px">股票板块</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="required" name="plateId" id="plateId"
                   autocomplete="off" placeholder="请输入股票名称" class="layui-input"
                   onkeyup="value=value.replace(/[\d]/g,'') "
                   onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[\d]/g,''))">
            <input type="hidden" name="fundName" id="hiddenFundName">
        </div>
    </div>
    <div class="layui-form-item" style="position: absolute;left: 28%; bottom: 20px">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="update"><i class="layui-icon">&#x1005;</i>修改</button>
            <button type="reset" class="layui-btn layui-btn-primary"> <i class="layui-icon">&#x1006;</i>取消</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    layui.use(['form','tableSelect'],function (){
        var form = layui.form;
        var $ = layui.jquery;
        var tableSelect = layui.tableSelect;
        form.on('submit(update)',function (obj) {
            // console.log("1"+obj.field);
            var data = form.val("updateform");

            $.post("toUpdateSecurity",data,function (msg) {
                console.log(msg)
            })
            return false;
        });
        tableSelect.render({
            elem: '#plateId',
            checkedKey: 'plateId',
            table: {
                url: 'selectPlate',
                cols: [
                    [
                        {type: 'radio', fixed: 'left'},
                        {field: 'plateName', title: '股票名称', sort: true, fixed: 'left'},
                        // ,{field: 'plateId', title: '股票Id'}
                    ]]
            },
            done: function (elem, data) {
                var NEWJSON = [];
                layui.each(data.data, function (index, item) {
                    NEWJSON.push(item.plateId)
                    $("#hiddenFundName").val(item.plateId)
                });
                elem.val(NEWJSON.join(","))
            }
        });
    });
</script>
</body>
</html>